-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add various hooks #676
Add various hooks #676
Conversation
I figured it would be more useful to hook after healing/taking damage rather than before
can you please explain why these hooks are needed? and provide an example of something you may want to do that you can't already do with the current hooks? |
This isn't related but I figured out why we don't have a hook that prevents objects from unloading. |
just a heads up, you could already do local sStep = false
hook_event(HOOK_BEFORE_PHYS_STEP, function(m, stepType, stepArgs)
if sStep then return end
if stepType ~= STEP_TYPE_AIR then return end
sStep = true
local stepResult = perform_air_step(m, stepArgs)
sStep = false
if stepResult == AIR_STEP_HIT_WALL then
return AIR_STEP_NONE
end
return stepResult
end) but it won't hurt to have it anyway. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some changes, also please fix merge conflicts
ceilOffset = ceilHeight - (nextPos[1] + 160.0f); | ||
if (ceilOffset < -30.0f) { stepResult = HANG_HIT_CEIL_OR_OOB; } | ||
if (ceilOffset > 30.0f) { stepResult = HANG_LEFT_CEIL; } | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why change this code? it was much more readable before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code was rewritten to be like this because all of the returns. although made the code easier to read, made it pretty incompatible with the hook.
if (m->health < 0x100) { | ||
if (m == &gMarioStates[0]) { | ||
// never kill remote marios | ||
set_mario_action(m, ACT_STANDING_DEATH, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the previous way of killing mario is still needed, because they were specifically for airborne actions. it would set mario as dead, but the death action doesn't play until mario reaches the floor. setting mario's action while in the air will teleport mario to the ground even if he's not there yet.
I don't think I'll go anywhere with this PR so I'll close it for now |
After my previous PR for HOOK_HEALED_MARIO and HOOK_HURT_MARIO got closed, I took the time to add in a new hook that I'd also like to see added
This PR includes:
HOOK_HEALED_MARIO (Params:
MarioState
m,MarioHealType
healType; Returns: None)HOOK_HURT_MARIO (Params:
MarioState
m,MarioHurtType
hurtType; Returns: None)HOOK_AFTER_QUARTER_STEP (Params:
MarioState
m,integer
stepType,integer
stepResult,integer
stepNumber; Returns:integer
stepResult`)I may add more hooks in the future but these are the main 3 I want in coop